$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'psdriverstatistics/list',
        datatype: "json",
        colModel: [			
			{ label: 'id', name: 'id', index: 'id', width: 50, key: true,hidden:true },
			{ label: '司机id', name: 'driverId', index: 'driver_id', width: 80,hidden:true },
			{ label: '司机姓名', name: 'driverName', index: 'driver_name', width: 80 }, 			
			{ label: '车型', name: 'carStyle', index: 'car_style', width: 50 },
			{ label: '支付宝收入', name: 'aliIncome', index: 'ali_income', width: 80 }, 			
			{ label: '微信收入', name: 'wxIncome', index: 'wx_income', width: 80 }, 			
			{ label: '现金收入', name: 'caseIncome', index: 'case_income', width: 80 }, 			
			{ label: '总收入', name: 'sumIncome', index: 'sum_income', width: 80 }, 			
			{ label: '支付宝提成', name: 'aliPercentage', index: 'ali_percentage', width: 80 }, 			
			{ label: '微信提成', name: 'wxPercentage', index: 'wx_percentage', width: 80 }, 			
			{ label: '现金提成', name: 'casePercentage', index: 'case_percentage', width: 80 }, 			
			{ label: '平台收入', name: 'platformIncome', index: 'platform_income', width: 80 }, 			
			{ label: '司机收入', name: 'driverIncome', index: 'driver_income', width: 80 }, 			
			{ label: '已提现', name: 'withdrawed', index: 'withdrawed', width: 80 }, 			
			{ label: '未提现', name: 'notWithdraw', index: 'not_withdraw', width: 80 }, 			
			{ label: '账户余额', name: 'balance', index: 'balance', width: 80 }
        ],
		viewrecords: true,
        height: 385,
        rowNum: 10,
		rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
});

var vm = new Vue({
	el:'#rrapp',
	data:{
		q:{
            driverName:null
		},
		showList: true,
		title: null,
		psDriverStatistics: {}
	},
	methods: {
		query: function () {
			vm.reload();
		},

		reload: function (event) {
			vm.showList = true;
			var page = $("#jqGrid").jqGrid('getGridParam','page');
			$("#jqGrid").jqGrid('setGridParam',{
                postData:{'driverName': vm.q.driverName},
                page:page
            }).trigger("reloadGrid");
		},
        back: function () {
            history.go(-1);
        }
	}
});